-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(#772) refactored / simplified parameters to KnResultCollector #773
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maximilien: 2 warnings.
In response to this:
Description
Simplify and consolidated parameters to
KnResultCollector
Changes
- pass
testing.T
toKnResultCollector
- pass
test.KnTest
toKnResultCollector
- change functions calls to only using new
KnResultCollector
parametersReference
Fixes #772
/lint
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/ok-to-test |
Please ignore the cc @navidshaikh |
/test pull-knative-client-integration-tests-latest-release |
Ok to merge @navidshaikh |
@@ -28,10 +28,13 @@ import ( | |||
func TestVersion(t *testing.T) { | |||
t.Parallel() | |||
|
|||
r := test.NewKnRunResultCollector(t) | |||
it, err := test.NewKnTest() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewKnTest()
will create a namespace for this test.
- We don't need namespace creation for version test.
- We dont have
tearDown
in this test, which leaving behind the created namespace.
Ran this locally from PR:
➜ client git:(c8c54c52) go test ./test/e2e/ -count=1 -test.v --tags e2e -run TestVersion
=== RUN TestVersion
=== PAUSE TestVersion
=== CONT TestVersion
--- PASS: TestVersion (5.54s)
PASS
ok knative.dev/client/test/e2e 5.544s
➜ client git:(c8c54c52) kubectl get ns|grep kne2etests
kne2etests0 Active 56s
If kn
doesn't require a namespace to execute, lets not create one? Call to NewKnTest()
will create one.
I'd still suggest the earlier review comment fix for version test, IMO no need to define a new method for only version test case.
func TestVersion(t *testing.T) {
t.Parallel()
r := test.NewKnRunResultCollector(t, nil)
defer r.DumpIfFailed()
out := test.RunKn("", []string{"version"})
r.AssertNoError(out)
assert.Check(t, util.ContainsAll(out.Stdout, "Version"))
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go without this, we'll have a namespace left behind from e2e test run which will break running e2e locally against same cluster in next run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having a way to run w/o namespace is important since remember that this code is now library that can be used outside. I added code to tear down the namespace when the test is done:
+ defer func() {
+ assert.NilError(t, it.Teardown())
+ }()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note also that the new code:
// RunNoNamespace the 'kn' CLI with args but no namespace
func (k Kn) RunNoNamespace(args ...string) KnRunResult {
return RunKn("", args)
}
Is pretty much just a wrapper to make clear we are running kn
on default namespace which is a useful thing in general. Keeps the VersionTest
consistent with the other tests. We still have various e2e
tests that need to be converged to this model so I think it's best to keep the simple VersionTest
in line with the others since people will use that as an exemplar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, as test.RunKn
is an exported method, this could actually be an example for how to run kn
without creating a namespace in tests. Say a plugin does not require a namespace to perform its task, its e2e can refer version tests.
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Lets get this in. I've added a comment on the version tests discussion about how plugins not requiring namespace to perform their tasks can use test.RunKn
.
@@ -28,10 +28,13 @@ import ( | |||
func TestVersion(t *testing.T) { | |||
t.Parallel() | |||
|
|||
r := test.NewKnRunResultCollector(t) | |||
it, err := test.NewKnTest() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, as test.RunKn
is an exported method, this could actually be an example for how to run kn
without creating a namespace in tests. Say a plugin does not require a namespace to perform its task, its e2e can refer version tests.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maximilien, navidshaikh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…d build 0.6 release (knative#773) * add CI flow for eventing, eventing-sources and build * update config.yaml
Description
Simplify and consolidated parameters to
KnResultCollector
Changes
testing.T
toKnResultCollector
test.KnTest
toKnResultCollector
KnResultCollector
parametersReference
Fixes #772
/lint